package com.hzdesk.media.matvector.koreabatch.client.my_paperless.logic.view;

import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hzdesk.media.matvector.koreabatch.client.my_paperless.R;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.base.BaseActivity;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.bean.DevicesCustomConfigurationBean;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.bean.DevicesManagerBean;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.logic.contract.IFileSetConfigContract;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.logic.persenter.FileSetConfigPersenter;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.utils.MyToastUtils;

/**
 * Created by Administrator on 2018/8/14.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 */

public class FileSetConfigActivity  extends BaseActivity implements IFileSetConfigContract.IFileSetConfigView {
    private View view;
    private RelativeLayout rl_file_name;
    private TextView tv_file_name;
    private EditText et_file;
    private RelativeLayout rl_metting_name;
    private TextView tv_metting_name;
    private RecyclerView recyclerview;
    private EditText et_file_type;

    private FileSetConfigPersenter mFileSetConfigPersenter = new FileSetConfigPersenter(this);
    private int devices_config_info_postion;
    private String devices_config_info_id;

    @Override
    protected void userAgreedPermissions() {

    }

    @Override
    protected View AddLayoutView() {
        View view = View.inflate(this,R.layout.activity_file_set_config,null);
        rl_file_name = view.findViewById(R.id.activity_file_set_config_rl_file_name);
        tv_file_name = view.findViewById(R.id.activity_file_set_config_tv_file_name);
        et_file = view.findViewById(R.id.activity_file_set_config_et_file);

        rl_metting_name = view.findViewById(R.id.activity_file_set_config_rl_metting_name);
        tv_metting_name = view.findViewById(R.id.activity_file_set_config_tv_metting_name);
        et_file_type = view.findViewById(R.id.activity_file_set_config_et_file_type);
        recyclerview = view.findViewById(R.id.activity_file_set_config_recyclerview);
        return view;
    }

    @Override
    protected void onStart() {
        super.onStart();
        mFileSetConfigPersenter.loadDate(this,devices_config_info_id,devices_config_info_postion);
        // todo 根据传递过来的数据显示
      //.  mFileSetConfigPersenter.initDate(this, devices_config_info_postion);
    }

    @Override
    protected void initChildViewDate() {
        Intent Intent = getIntent();
        devices_config_info_postion = Intent.getIntExtra("devices_config_info_postion",0);
        devices_config_info_id = Intent.getStringExtra("devices_config_info_id");

        mFileSetConfigPersenter.initTitle();
        mFileSetConfigPersenter.initRecyclerView(recyclerview,this);

    }

    @Override
    protected void onClickedTvRight() {
        mFileSetConfigPersenter.SaveDate(this,devices_config_info_postion);
    }


    @Override
    protected void onClickedIvRight() {

    }

    @Override
    protected void onClickedIvLeft() {
        finish();
    }

    @Override
    public void showTitle() {
        showTilteBg();
        showTitleContent();
        showTilteRightTVContent();
        showTileIvLeft();

        //设备管理(6)
        setTitleContent("配置文件设置", 0xffffffff);
        setTitleContentSize(18);
        setTilteRightTVContent("保存",0xffffffff);
        setTilteRightTVContentSize(16);
        setIvLeftIcon(R.mipmap.left_white_return);
    }

    @Override
    public void toMouseSetPager(DevicesCustomConfigurationBean.DeviceMousesBean bean,int postion,String devicesAttrId) {
      //  toPageJump(MouseSetActivity.class);
        Intent intent = new Intent(this,MouseSetActivity.class);
        intent.putExtra("file_set_config_to_mouse_set",bean);
        intent.putExtra("file_mouse_set_selelctor_postion",postion);
        intent.putExtra("file_mouse_devicesAttrId",devicesAttrId);
        startActivity(intent);
    }

    @Override
    public String getFileName() {
        return et_file.getText().toString().trim();
    }

    @Override
    public void SetFileName(String name) {
        et_file.setText(name);

    }

    @Override
    public String getMettingName() {
        return et_file_type.getText().toString().trim();
    }

    @Override
    public void setMettingName(String name) {
        et_file_type.setText(name);
    }

    @Override
    public void finshPager() {
        finish();
    }

    @Override
    public void showToastMessage(String message) {
        MyToastUtils.ShortToaseShow(this,message);
    }
}
